package com.bainaeco.framework.util.serializer;

import java.io.IOException;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;

/**
 * Custom double serializer
 * @author Joe Zhou
 */
public class CustomDoubleSerializer extends JsonSerializer<Double>{
	
	@Override
	public void serialize(Double arg0, JsonGenerator arg1, SerializerProvider arg2)
			throws IOException, JsonProcessingException {
		String value = Format.decimalToString(arg0);
		arg1.writeString(value);
	}

}
